package com.order.rest;

import com.order.exception.CustomException;
import com.order.service.SessionService;
import com.order.service.impl.SessionServiceImpl;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

@RestController
public class SessionRest {
    @Autowired
    private SessionService sessionService;
    private Logger logger = LoggerFactory.getLogger(getClass());
    @ApiOperation(value = "申请Session", httpMethod = "GET")
    @ApiResponses({
            @ApiResponse(code = 400, message = "参数不正确")
    })
    @RequestMapping(value = "/v1/session", method = RequestMethod.GET)
    public Map<String, Object> getSession()throws CustomException {
        Map<String, Object> result = new HashMap<>();
        result.put("Sessionid",sessionService.getSession());
        return result;
    }
}
